package com.liangzhong.model.activity
{
	import flash.events.Event;
	import flash.events.EventDispatcher;

	/**
	 *充值活动 
	 * @author lake
	 * 
	 */	
	public class ActivityFiveVo extends EventDispatcher
	{
		/**
		 *当天比赛场数 
		 */		
		public var matchCount 		:int ;
		/**
		 *开金粽子次数 
		 */		
		public var openJinCount		:int;
		/**
		 *奖励数组 
		 */		
		public var values			:Array = [10,20,30,40,50];
		/**
		 *领取状态 
		 */		
		public var recStatus		:Array = [4,4,4,4,4];
		/**
		 *领取成功
		 * 界面表现 
		 */		
		public var recSuccess   	:Boolean = false;
		
		public function ActivityFiveVo()
		{
			//测试
			//matchCount = 15;
			//recStatus = [3,4,4,4,4];
		}
		/**
		 *返回级别 
		 * @return 
		 * 
		 */		
		public function get qLevel():int
		{
			var lv :int = 0;
			if(matchCount >= 10 && matchCount < 20)
			{
				lv = 1;
			}
			else if(matchCount >= 20 && matchCount < 30)
			{
				lv = 2;
			}
			else if(matchCount >= 30 && matchCount < 40)
			{
				lv = 3;
			}
			else if(matchCount >= 40 && matchCount < 50)
			{
				lv = 4;
			}
			else if(matchCount >= 50)
			{
				lv = 5;
			}
			return lv;
		}
		/**
		 *解析数据 
		 * @param obj
		 * 
		 */		
		public function parse(obj :Object):void
		{
			var itemObj :Object;
			matchCount = obj.cnt;
			openJinCount = obj.times;
			var i :int = 0;
			for(i = 0;i < 5;i ++)
			{
				itemObj = obj.list["" + (i+1)];
				if(itemObj.is_get == 1)//可领取
				{
					recStatus[i] = 3;
				}
				if(itemObj.has_get == 1)//已经领取
				{
					recStatus[i] = 2;
				}
			}
			//测试
			//matchCount = 10;
			//recStatus = [2,3,3,3,4];
			recSuccess = false;
			this.dispatchEvent(new Event(Event.CHANGE));
		}
	}
}